﻿#pragma once


#include "Containers/String.h"
#include "Containers/SharedObjectPtr.h"
#include "Widgets/WidgetAttribute.h"
#include <functional>

class RWidget;
class RTexture2D;

//a square button with:
//  a image in center
//  a grey background little bigger than the image
//  a tooltip when mouse hover
namespace WHE
{


    struct SImageButtonCreateInfo
    {
        //父级窗口 不能为空
        TSharedObjectPtr<RWidget> ParentWidget;

        //按钮大小
        float Size = 24.0f;

        //图标
        TWidgetAttribute<TSharedObjectPtr<RTexture2D>> Icon;

        //图标大小
        float IconSize = 14.0f;       

        //提示
        TWidgetAttribute<CString> ToolTip;

        //按下时的响应
        //如果按钮被禁用，则不会触发
        std::function<void()> OnClick;

        //是否可用
        TWidgetAttribute<bool> Enabled=true;

    };

    TSharedObjectPtr<RWidget> CreateImageButton(const SImageButtonCreateInfo& InCreateInfo);

    TSharedObjectPtr<RWidget> CreateImageButton(
        TWidgetAttribute<TSharedObjectPtr<RTexture2D>> InIcon
        ,TWidgetAttribute<CString> InToolTip
        ,std::function<void()> InOnClick
        ,TSharedObjectPtr<RWidget> InParentWidget
        ,float Size = 24.0f
        ,float IconSize = 14.0f
        );
}